<section id="message">
<div class="block-border" align="Center">
<div class="block-content no-title dark-bg">
<p class="mini-infos">会議室予約システム - TEAM 13</p>
</div>
</div>
</section>

<section id="login-block">
<div class="block-border">
<div class="block-content"><!--
			IE7 compatibility: if you want to remove the <h1>, 
			add style="zoom:1" to the above .block-content div
			-->

<div class="block-header">ログインしてください</div>
<?php 
	if($this->err_msg != null){ ?>
	<p class="message error no-margin"><?php echo $this->err_msg; ?></p>
	<?php 		
	}
?>
<p class="message error no-margin" id="err_msg" style="display: none">error message</p>

<form class="form with-margin" name="login-form" id="form"
	method="post" action="/login">
<p class="inline-small-label"><label for="login"><span class="big">ユーザー名</span></label>
<input type="text" name="login" id="login" class="full-width" value="">
</p>
<p class="inline-small-label"><label for="pass"><span class="big">パスワード</span></label>
<input type="password" name="pass" id="pass" class="full-width" value="">
</p>

<button type="submit" class="float-right">ログイン</button>
<button type="button" class="float-right" onclick="window.location = '/regist';">登録</button>
</form>

<form class="form" id="password-recovery" method="post" action="/user/resetpass">
<fieldset class="grey-bg no-margin collapse"><legend><a href="#">パスワードをお忘れですか ?</a></legend>
<p class="input-with-button"><label for="recovery-mail">メールアドレース</label>
<input type="text" name="recovery-mail" id="recovery-mail">
<button type="submit">送信</button>
</p>
</fieldset>
</form>
</div>
</div>
</section>
<script type="text/javascript">
$(document).ready(function(){
	$('#form').submit(function(){
		var login = $('#login').val();
		var pass = $('#pass').val();
	if (!login || login.length == 0)
	{
		//$('#login-block').removeBlockMessages().blockMessage('Please enter your user name', {type: 'warning'});
		$("#err_msg").css("display", "");
		$("#err_msg").html("ユーザー名を入力してください");
		return false;
	}
	else if (!pass || pass.length == 0)
	{
		//$('#login-block').removeBlockMessages().blockMessage('Please enter your password', {type: 'warning'});
		$("#err_msg").css("display", "");
		$("#err_msg").html("パスワードを入力してください");
		return false;
	}
	else 
		{
		var ajax_url = "/login";
		var datas = "login=" + login.val() + "&pass=" + pass.val();
		jQuery.ajax({
			url : ajax_url,
			data : datas,
			type : "POST",
			success : function(data) {
			  $("#form").html(data);
		  	}
			});
		
		}
	})
});
</script>